import "./jquery-2.2.4.js";
import "./hammer.js";
import "./ScrollText.js";
import "./winnie.js";
import "./../css/common.css";
import "./../css/style.css";





getData(getItUrl, {"id":id}, function (data) {
    canGet = true;
    if(data.retcode == 1){ //成功
        layer.msg("领取成功！");
        // innit();
        setTimeout(function (param) {
            reload();
        },2000);
    }else if(data.retcode == -1){ 
        $(".tipBox").hide();
        $("#noPointsBox").show();
    }else{
        layer.msg(data.retmsg);
    }
});

function testStyle(style) {
	var CSS = window["CSS"] || {};
	if(CSS.supports) {
		if(typeof CSS.supports == "function") {
			if(CSS.supports("width", "1vw")) {
				return true;
			}
		}
	}
	return false;
}

function initWindow(window, viewWidth) {
	var clientWidth = (document.documentElement || document.body).clientWidth;
	var htmlDom = document.getElementsByTagName("html")[0];
	if(clientWidth >= 480) {
		htmlDom.style.fontSize = 100 * (480 / viewWidth) + "px";
	} else {
		if(!testStyle('vw')) {
			function resize() {
				htmlDom.style.fontSize = 100 * (clientWidth / viewWidth) + "px";
				if(clientWidth > 480) {
					htmlDom.style.fontSize = 100 * (480 / viewWidth) + "px";
				}
			}
			resize();
			window.addEventListener("resize", resize);
		}
	}
}
initWindow(window,750);
function appendList(data){
    var html = "";
    var len =data.length;
    var template = '<li>'+
        '<a href="javascript:GameCenter.authUrl({{itemId}},\'{{param}}\');">'+
            '<img class="imgUrl" src="{{src}}" alt="">'+
            '<div class="right">'+
                '<h5 class="name">{{name}}<img class="icon_hot" style="display:{{display}}" src="https://downqn.tuyoo.com/offical_accounts/gameBox/icon_tag@2x.png"/></h5>'+
                '<p class="des">{{description}}</span>'+
                    '<p class="howmany"><em>{{peopleNum}}</em>万人在玩</span>'+
            '</div>'+
            '<button class="goGame">进入</button>'+
        '</a>'+
    '</li>';
    for (var i = 0; i < len; i++) {
        if(data[i].isHot == 1){
            var isShow = "inline";
        }else{
            var isShow = "none";
        }
        html += GameCenter.renderTemplate(template, {
            display:isShow,
            name: data[i].name,
            itemId:data[i].itemId,
			param:data[i].wxparam,
			src: data[i].src,
            description: data[i].describe,
            peopleNum: data[i].people
        });
    }
    return html;
}


